/*
 * LongestComparator.java
 *
 * Created on 14 March 2007, 02:29
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package net.siit.datatype;

import java.util.Comparator;

/**
 *
 * @author art
 */
public class LongestComparator implements Comparator<String> {
    public int compare(String o1, String o2) {
        int diff = o2.length() - o1.length();
        if (diff != 0) return diff;
        return o1.compareTo(o2); // if same length, compare "alphabetically"
    }
}